window.console = (function (originConsole) {
	if (!window.console || !originConsole) {
		originConsole = {}
	}

	const typeColor = {
		primary: '#409EFF',
		success: '#67C23A',
		danger: '#F56C6C',
		warning: '#E6A23C'
	}

	const getColor = function (type) {
		return typeColor[type] || 'none'
	}

	const print = function (textObj) {
		console.log(`%c${textObj.text || ''}`, `color:${getColor(textObj.type)};`)
	}

	originConsole.primary = function (...rest) {
    print({ text: rest, type: 'primary' })
	}

	originConsole.success = function (...rest) {
    print({ text: rest, type: 'success' })
	}

	originConsole.warning = function (...rest) {
    print({ text: rest, type: 'warning' })
	}

	originConsole.danger = function (...rest) {
    print({ text: rest, type: 'danger' })
	}

	originConsole.capsule = function (title, info, type = 'primary') {
    console.log(`%c${title}%c${info}%c`, `background:${getColor(type)}; padding: 2px 3px; border-radius: 3px 0 0 3px; color: #fff;`, 'background:#35495E; padding: 2px 5px; border-radius: 0 3px 3px 0; color: #fff;', 'background:transparent')
	}

	return originConsole
})(window.console)


